#lang racket
; Selection-sort(Сортировка выбором)
(define (selection lst) 
   (cond 
     [(empty? lst) '()]
       (else 
        (cons(smallest lst (car lst))(selection(remove lst(smallest lst(car lst))))) 
       )
   )
)

(define (remove lst n)                
  (cond 
    [(empty? lst) '()]           
    [(= (car lst) n) (cdr lst)]   
      (else 
       (cons (car lst)(remove (cdr lst) n))
       )   
   )
 )

(define (smallest lst n)            
  (cond 
    [(empty? lst) n]
    [(< (car lst) n)(smallest (cdr lst)(car lst))]
       (else 
        (smallest (cdr lst) n )
        )
  )
)
